package com.d3works.apps.purchase.service;

import com.d3works.apps.account.db.TaxLine;
import com.d3works.apps.base.db.Company;
import com.d3works.apps.base.db.Currency;
import com.d3works.apps.base.db.Partner;
import com.d3works.apps.base.db.Product;
import com.d3works.apps.purchase.db.SupplierCatalog;
import com.d3works.exception.D3worksException;
import com.d3works.rpc.ActionRequest;
import com.d3works.rpc.ActionResponse;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Map;

public interface SupplierCatalogService {

  public Map<String, Object> updateInfoFromCatalog(
      Product product,
      BigDecimal qty,
      Partner partner,
      Currency currency,
      LocalDate date,
      Company company)
      throws D3worksException;

  public SupplierCatalog getSupplierCatalog(
      Product product, Partner supplierPartner, Company company) throws D3worksException;

  Map<String, String> getProductSupplierInfos(Partner partner, Company company, Product product)
      throws D3worksException;

  BigDecimal getQty(Product product, Partner supplierPartner, Company company)
      throws D3worksException;

  /**
   * A function used to get the unit price of a purchase order line or invoice line either in ati or
   * wt
   *
   * @param product
   * @param supplierPartner
   * @param company
   * @param currency
   * @param localDate
   * @param taxLine
   * @param resultInAti
   * @return
   * @throws D3worksException
   */
  BigDecimal getUnitPrice(
      Product product,
      Partner supplierPartner,
      Company company,
      Currency currency,
      LocalDate localDate,
      TaxLine taxLine,
      boolean resultInAti)
      throws D3worksException;

  BigDecimal getMinQty(Product product, Partner supplierPartner, Company company)
      throws D3worksException;

  void checkMinQty(
      Product product,
      Partner supplierPartner,
      Company company,
      BigDecimal qty,
      ActionRequest request,
      ActionResponse response)
      throws D3worksException;
}
